package cn.buk.tms.eotms.response;

import cn.buk.common.JsonResult;
import com.fasterxml.jackson.annotation.JsonInclude;

/**
 * 创建订单的返回内容
 * @author yfdai
 */
public class CreateFlightOrderResponse extends JsonResult {

  public static CreateFlightOrderResponse createResponse(int retCode) {
    return createResponse(retCode, null);
  }

  public static CreateFlightOrderResponse createResponse(int retCode, String errmsg) {

    var rs = new CreateFlightOrderResponse();

    rs.setErrmsg(errmsg);

    if (retCode > 0) {
      rs.setErrcode(0);
      rs.setStatus(STATUS_OK);
      rs.setReturnCode(retCode);
      rs.setDesc(errmsg);
    } else {
      rs.setErrcode(Math.abs(retCode));
      rs.setStatus(STATUS_ER);
    }

    return rs;
  }

  /**
   * 订单号
   */
  @JsonInclude(JsonInclude.Include.NON_NULL)
  private String orderNo;

  public String getOrderNo() {
    return orderNo;
  }

  public void setOrderNo(String orderNo) {
    this.orderNo = orderNo;
  }
}
